using System;
using System.Collections.Generic;
using System.Text;

namespace TextEditor
{
    public class A_lockCell: A_Action
    {
        public override string ActionName()
        {
            return "lockCell";
        }
        public override int CheckState()
        {
            ZYTextTableCell cell = base.myOwnerDocument.GetInTableCell(base.myOwnerDocument.Content.CurrentElement);
            if (cell != null)
                return cell.CanDelete ? 1 : 0;
            return 0;
        }

        public override bool isEnable()
        {
            return base.myOwnerDocument.GetInTableCell(base.myOwnerDocument.Content.CurrentElement) == null ? false : true;
        }

        public override bool UIExecute()
        {
            ZYTextTableCell cell = base.myOwnerDocument.GetInTableCell(base.myOwnerDocument.Content.CurrentElement);
            if (cell != null)
            {
                cell.CanDelete = !cell.CanDelete;
            }
            return true;
        }
    }
}
